perm filename TMP.WEB[TEX,DEK] blob sn#841385 filedate 1987-06-13 generic text, type T, neo UTF8
@ In \sec38, define \\{str\_number} to be the same as \\{pool\_pointer},
and define |str_end=128|.
In \sec39, delete the declaration of |str_start|.
In \sec40, declare

@p function length(s:str_number):integer;
var t:pool_pointer;
begin t←s;
while str_pool[t]≠str_end do incr(t);
length←t-s;
end;

@ In \sec41, define |cur_length==(pool_ptr-str_ptr)|. In \sec43, declare

@p function make_string:str_number; {current string enters the pool}
var t:str_number; {the result}
begin str_room(1); append(str_end);@/
t←str_ptr; str_ptr←pool_ptr; make_string←t;
end;

@ In \sec44, we can

@d flush_string==@+begin repeat decr(str_ptr); until str_pool[str_ptr-1]=str_end;
	pool_ptr←str_ptr;
	end

@ The comparison function in \sec45 is used only in \sec259, where we can
replace `|if length(text(p))=l then if str_eq_buf(text(p),j)|' by
`|if str_eq_buf(text(p),j,l)|'. The function now has three parameters:

@p function str_eq_buf(s:str_number; k,l:integer):boolean; {test equality of strings}
label exit;
var j:pool_pointer; {running index}
begin j←s; s←s+l;
if str_pool[s]≠str_end then str_eq_buf←false
else	begin while j<s do
		begin if str_pool[j]≠buffer[k] then
			begin str_eq_buf←false; return;
			end;
		incr(j); incr(k);
		end;
	str_eq_buf←true;
	end;
exit:end;

@ The procedure of \sec46 is modified in an obvious way.

The first three statements of \sec47 become just two:
`|pool_ptr←128; str_ptr←128|'. The body of the {\bf for} loop in \sec48
becomes just

@p if (@<Character |k| cannot be printed@>) then
	if k<@'100 then str_pool[k]←k+@'100
	else str_pool[k]←k-@'100
else str_pool[k]←k

@ In \sec59, variable $j$ is no longer needed. If |0≤s<128| and if $s$
isn't the current new-line character, we now say

@p begin if str_pool[s]≠s then
	begin print_char("↑"); prnt_char("↑");
	end;
print_char(str_pool[s]);
end

@ In the other case, where |s≥128|, we say

@p while str_pool[s]≠str_end do
	begin print_char(str_pool[s]); incr(s);
	end

@ In \sec407, similarly, variable $k$ is eliminated; the loop on~$k$
becomes a loop on~$s$, |while str_pool[s]≠str_end|.

In \sec464, replace the two occurrences of `|str_start[str_ptr]|' by
`|str_ptr|'.

The first loop in \sec603 becomes

@p k←font_area[f]; while str_pool[k]≠str_end do
	begin dvi_out(str_pool[k]); incr(k);
	end